#include <DApplication>
#include <DApplicationSettings>
#include <DWidgetUtil>
#include "mainwindow.h"
#include "application.h"

DWIDGET_USE_NAMESPACE

int main(int argc, char *argv[])
{
    //解决 root/ubuntu 主题样式走形
  qputenv("XDG_CURRENT_DESKTOP", "Deepin");
  QGuiApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);

    // 程序内强制添加 -platformtheme
  // deepin 参数喂给 Qt 让 Qt 正确使用 Deepin 主题修复各种奇怪样式问题
  QVector<char *> fakeArgs(argc + 2);
  char fa1[] = "-platformtheme";
  char fa2[] = "deepin";
  fakeArgs[0] = argv[0];
  fakeArgs[1] = fa1;
  fakeArgs[2] = fa2;

  for (int i = 1; i < argc; i++)
    fakeArgs[i + 2] = argv[i];
  int fakeArgc = argc + 2;


    Application a(fakeArgc, fakeArgs.data());

    DApplicationSettings savetheme;
    Q_UNUSED(savetheme)

    // 主窗口
    MainWindow mw;
    mw.show();

    Dtk::Widget::moveToCenter(&mw);

    // 消息循环
    return a.exec();
}
